package com.qingmi.farmer.data.model;

import android.os.Parcel;
import android.os.Parcelable;

import com.google.gson.annotations.SerializedName;

/**
 * 地址信息
 * Created by 67535 on 2018/5/30.
 */
public class Address implements Parcelable {

    //id
    @SerializedName("AddressId")
    private String addressId;

    //别名
    @SerializedName("Alias")
    private String alias;

    //收货人
    @SerializedName("LinkName")
    private String linkName;

    //地址
    @SerializedName("Address")
    private String address;

    //手机号码
    @SerializedName("Phone")
    private String phone;

    //是否默认
    @SerializedName("Default")
    private boolean isDefault;

    //城市
    @SerializedName("CityId")
    private String cityId;

    //城市名字
    @SerializedName("CityName")
    private String cityName;

    public Address() {
    }

    protected Address(Parcel in) {
        addressId = in.readString();
        alias = in.readString();
        linkName = in.readString();
        address = in.readString();
        phone = in.readString();
        isDefault = in.readByte() != 0;
        cityId = in.readString();
        cityName = in.readString();
    }

    public static final Creator<Address> CREATOR = new Creator<Address>() {
        @Override
        public Address createFromParcel(Parcel in) {
            return new Address(in);
        }

        @Override
        public Address[] newArray(int size) {
            return new Address[size];
        }
    };

    public String getAddressId() {
        return addressId;
    }

    public void setAddressId(String addressId) {
        this.addressId = addressId;
    }

    public String getAlias() {
        return alias;
    }

    public void setAlias(String alias) {
        this.alias = alias;
    }

    public String getLinkName() {
        return linkName;
    }

    public void setLinkName(String linkName) {
        this.linkName = linkName;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public boolean isDefault() {
        return isDefault;
    }

    public boolean getIsDefault() {
        return isDefault;
    }

    public void setDefault(boolean aDefault) {
        isDefault = aDefault;
    }

    public String getCityId() {
        return cityId;
    }

    public void setCityId(String cityId) {
        this.cityId = cityId;
    }

    public String getCityName() {
        return cityName;
    }

    public void setCityName(String cityName) {
        this.cityName = cityName;
    }

    @Override
    public String toString() {
        return alias;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(addressId);
        dest.writeString(alias);
        dest.writeString(linkName);
        dest.writeString(address);
        dest.writeString(phone);
        dest.writeByte((byte) (isDefault ? 1 : 0));
        dest.writeString(cityId);
        dest.writeString(cityName);
    }
}